<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QHoverEvent Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QHoverEvent Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QHoverEvent class contains parameters that describe a mouse
event. <a href="#details">More...</a></p>

<p>Inherits <a href="qevent.html">QEvent</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qhoverevent.html#QHoverEvent">__init__</a></b> (<i>self</i>, QEvent.Type&#160;<i>type</i>, QPoint&#160;<i>pos</i>, QPoint&#160;<i>oldPos</i>)</li><li><div class="fn" /><b><a href="qhoverevent.html#QHoverEvent-2">__init__</a></b> (<i>self</i>, QHoverEvent)</li><li><div class="fn" />QPoint <b><a href="qhoverevent.html#oldPos">oldPos</a></b> (<i>self</i>)</li><li><div class="fn" />QPoint <b><a href="qhoverevent.html#pos">pos</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QHoverEvent class contains parameters that describe a mouse
event.</p>
<p>Mouse events occur when a mouse cursor is moved into, out of, or
within a widget, and if the widget has the <a href="qt.html#WidgetAttribute-enum">Qt.WA_Hover</a> attribute.</p>
<p>The function <a href="qhoverevent.html#pos">pos</a>() gives the
current cursor position, while <a href="qhoverevent.html#oldPos">oldPos</a>() gives the old mouse
position.</p>
<p>There are a few similarities between the events <a href="qevent.html#Type-enum">QEvent.HoverEnter</a> and <a href="qevent.html#Type-enum">QEvent.HoverLeave</a>, and the events
<a href="qevent.html#Type-enum">QEvent.Enter</a> and <a href="qevent.html#Type-enum">QEvent.Leave</a>. However, they are
slightly different because we do an update() in the event handler
of <a href="qevent.html#Type-enum">HoverEnter</a> and <a href="qevent.html#Type-enum">HoverLeave</a>.</p>
<p><a href="qevent.html#Type-enum">QEvent.HoverMove</a> is also
slightly different from <a href="qevent.html#Type-enum">QEvent.MouseMove</a>. Let us consider a
top-level window A containing a child B which in turn contains a
child C (all with mouse tracking enabled):</p>
<p class="centerAlign"><img alt="" src="images/hoverevents.png" /></p>
<p>Now, if you move the cursor from the top to the bottom in the
middle of A, you will get the following <a href="qevent.html#Type-enum">QEvent.MouseMove</a> events:</p>
<ol class="1">
<li>A.MouseMove</li>
<li>B.MouseMove</li>
<li>C.MouseMove</li>
</ol>
<p>You will get the same events for <a href="qevent.html#Type-enum">QEvent.HoverMove</a>, except that the
event always propagates to the top-level regardless whether the
event is accepted or not. It will only stop propagating with the
<a href="qt.html#WidgetAttribute-enum">Qt.WA_NoMousePropagation</a>
attribute.</p>
<p>In this case the events will occur in the following way:</p>
<ol class="1">
<li>A.HoverMove</li>
<li>A.HoverMove, B.HoverMove</li>
<li>A.HoverMove, B.HoverMove, C.HoverMove</li>
</ol>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QHoverEvent" />QHoverEvent.__init__ (<i>self</i>, <a href="qevent.html#Type-enum">QEvent.Type</a>&#160;<i>type</i>, <a href="qpoint.html">QPoint</a>&#160;<i>pos</i>, <a href="qpoint.html">QPoint</a>&#160;<i>oldPos</i>)</h3><p>Constructs a hover event object.</p>
<p>The <i>type</i> parameter must be <a href="qevent.html#Type-enum">QEvent.HoverEnter</a>, <a href="qevent.html#Type-enum">QEvent.HoverLeave</a>, or <a href="qevent.html#Type-enum">QEvent.HoverMove</a>.</p>
<p>The <i>pos</i> is the current mouse cursor's position relative
to the receiving widget, while <i>oldPos</i> is the previous mouse
cursor's position relative to the receiving widget.</p>


<h3 class="fn"><a name="QHoverEvent-2" />QHoverEvent.__init__ (<i>self</i>, <a href="qhoverevent.html">QHoverEvent</a>)</h3><h3 class="fn"><a name="oldPos" /><a href="qpoint.html">QPoint</a> QHoverEvent.oldPos (<i>self</i>)</h3><p>Returns the previous position of the mouse cursor, relative to
the widget that received the event. If there is no previous
position, oldPos() will return the same position as <a href="qhoverevent.html#pos">pos</a>().</p>
<p>On <a href="qevent.html#Type-enum">QEvent.HoverEnter</a>
events, this position will always be <a href="qpoint.html">QPoint</a>(-1, -1).</p>
<p><b>See also</b> <a href="qhoverevent.html#pos">pos</a>().</p>


<h3 class="fn"><a name="pos" /><a href="qpoint.html">QPoint</a> QHoverEvent.pos (<i>self</i>)</h3><p>Returns the position of the mouse cursor, relative to the widget
that received the event.</p>
<p>On <a href="qevent.html#Type-enum">QEvent.HoverLeave</a>
events, this position will always be <a href="qpoint.html">QPoint</a>(-1, -1).</p>
<p><b>See also</b> <a href="qhoverevent.html#oldPos">oldPos</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>